/*
 * @Author: yuki
 * @Date: 2025-11-06 15:32:09
 * @LastEditTime: 2025-11-06 16:08:51
 * @Description: 用户模块dto
 */
import { Type } from 'class-transformer';
import { IsInt, IsString, Length, Min, ValidateIf } from 'class-validator';

export class GetUserInfoDto {
  @ValidateIf(o => !!o.id)
  @Type(() => Number)
  @IsInt({ message: '用户ID必须是整数' })
  @Min(1, { message: '用户ID不正确' })
  id: number;
  @ValidateIf(o => !!o.username)
  @IsString({ message: '用户名必须是字符串' })
  @Length(4, 16, { message: '用户名长度必须是4到16个字符' })
  username: string;
}
